#pragma once

class Parser;
class Action
{
public:
	Action(){}
	virtual ~Action(){}
	virtual void Do(){}
};

class Parser  
{
public:
	Parser();
	~Parser();
	void Parse();

protected:
	void addAction(Action*);

protected:
	std::vector<Action*> actions;
};



//////////////////////////////////////////////////////////////////////////////
// Single
//////////////////////////////////////////////////////////////////////////////
class BetParser : public Parser
{
public:
	BetParser(){}
	~BetParser(){}
};


//////////////////////////////////////////////////////////////////////////////
// PairParser
//////////////////////////////////////////////////////////////////////////////
class PairParser : public Parser
{
public:
	PairParser();
	virtual ~PairParser();
	virtual bool IsA(int num){return false;}
	virtual bool IsB(int num){return false;}

protected:
	int A,B;      // betname
};

class BlackRedParser : public PairParser
{
public:
	BlackRedParser(){A=Black; B=Red;}
	~BlackRedParser(){}
	virtual bool IsA(int num){Num data(num); return data.IsBlack();}
	virtual bool IsB(int num){Num data(num); return data.IsRed();}
};
class RedBlackParser : public PairParser
{
public:
	RedBlackParser(){A=Red; B=Black;}
	~RedBlackParser(){}
	virtual bool IsA(int num){Num data(num); return data.IsRed();}
	virtual bool IsB(int num){Num data(num); return data.IsBlack();}
};
class EvenOddPair : public PairParser
{
public:
	EvenOddPair(){A=Even; B=Odd;}
	~EvenOddPair(){}
	virtual bool IsA(int num){Num data(num); return data.IsEven();}
	virtual bool IsB(int num){Num data(num); return data.IsOdd();}
};
class OddEvenPair : public PairParser
{
public:
	OddEvenPair(){A=Odd; B=Even;}
	~OddEvenPair(){}
	virtual bool IsA(int num){Num data(num); return data.IsOdd();}
	virtual bool IsB(int num){Num data(num); return data.IsEven();}
};
class BigSmallPair : public PairParser
{
public:
	BigSmallPair(){A=Big; B=Small;}
	~BigSmallPair(){}
	virtual bool IsA(int num){Num data(num); return data.IsBig();}
	virtual bool IsB(int num){Num data(num); return data.IsSmall();}
};
class SmallBigPair : public PairParser
{
public:
	SmallBigPair(){A=Small; B=Big;}
	~SmallBigPair(){}
	virtual bool IsA(int num){Num data(num); return data.IsSmall();}
	virtual bool IsB(int num){Num data(num); return data.IsBig();}
};



//////////////////////////////////////////////////////////////////////////////
// TriangleParser
//////////////////////////////////////////////////////////////////////////////
class TriangleParser : public Parser
{
public:
	TriangleParser();
	~TriangleParser();
	bool IsA(int num){return false;}
	bool IsB(int num){return false;}
	bool IsC(int num){return false;}

public:
	int A,B,C;
};


class VertChainer :  public TriangleParser
{
public:
	VertChainer(){A=V1;B=V2;C=V3;}
	~VertChainer(){}
	bool IsA(int num){Num data(num); return data.IsV1();}
	bool IsB(int num){Num data(num); return data.IsV2();}
	bool IsC(int num){Num data(num); return data.IsV3();}
};
class HoriChainer :  public TriangleParser
{
public:
	HoriChainer(){A=H1;B=H2;C=H3;}
	~HoriChainer(){}
	bool IsA(int num){Num data(num); return data.IsH1();}
	bool IsB(int num){Num data(num); return data.IsH2();}
	bool IsC(int num){Num data(num); return data.IsH3();}
};



//////////////////////////////////////////////////////////////////////////////
// Actions
//////////////////////////////////////////////////////////////////////////////

class Action1 : public Action
{
public:
	Action1(TriangleParser *owner){parser=owner;}
	~Action1(){}
	virtual void Do();

    TriangleParser *parser;
};

class Action2 : public Action
{
public:
	Action2(TriangleParser *owner){parser=owner;}
	~Action2(){}
	virtual void Do();

    TriangleParser *parser;
};

class Action3 : public Action
{
public:
	Action3(TriangleParser *owner){parser=owner;}
	~Action3(){}
	virtual void Do();

    TriangleParser *parser;
};
